package cn.rwklyd.BookKeeping.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;


@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "users")                      // 使用MP,表名与数据库表名不一致时,使用value指定表名
public class User {
    @TableId(value = "id", type = IdType.AUTO)   // 使用MP,主键自增
    @Schema(description = "用户ID")
    private Integer id;

    @TableField(value = "username")      // 使用MP,字段名与数据库字段名不一致时,使用value指定字段名
    @Schema(description = "用户名")
    private String username;

    @TableField(value = "password")
    @Schema(description = "密码")
    private String password;

    @TableField(value = "nickname")
    @Schema(description = "昵称")
    private String nickname;

    @TableField(value = "avatar")
    @Schema(description = "头像")
    private String avatar;

    @TableField(value = "email")
    @Schema(description = "邮箱")
    private String email;

    @TableField(value = "role_id")
    @Schema(description = "角色ID")
    private Integer roleId;

    @TableField(value = "status")
    @Schema(description = "用户状态")
    private UserStatus status = UserStatus.active;

    @TableField(value = "bio")
    @Schema(description = "简介")
    private String bio;

    @TableField(value = "created_at")
    @Schema(description = "创建时间")
    private String createdAt;

    @TableField(value = "updated_at")
    @Schema(description = "更新时间")
    private String updatedAt;

    public enum UserStatus {
        active, inactive, locked
    }
}
